<?php
namespace app\api\controller;
use think\Controller;
use app\api\model\Order as Orders;
/**
 * 
 * @author sj
 * 订单信息
 *
 */
class Order extends Co{
    protected  static  $OrderModel;
    protected $beforeActionList = [
        'first'
    ];
    public  function  first(){
        if(!self::$OrderModel instanceof self){
            self::$OrderModel=new Orders();
        }
    }
    public function create(){
       $data=array('user_id'=>1,'order_number'=>create_sn(),'place_id'=>1);
       dump($data);
       $res=self::$OrderModel->add($data);
       if($res){
           ajaxReturn2(1,'生成订单成功','');
       }else{
           ajaxReturn2(0,'生成订单失败','');
       }
    }
}